package com.google.gwt.livinglife.client.widgets;

import com.google.gwt.livinglife.client.data.LivingLifeGroupData;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.VerticalPanel;

public class GroupListWidget extends VerticalPanel {
	HTML header = new HTML();
	Boolean empty = true;
	public GroupListWidget() {
		add(header);
		header.setHorizontalAlignment(ALIGN_CENTER);
	}
	public void setHeader(String title) {
		header.setHTML("<h3>" + title + "</h3>");
	}
	public void addGroup(LivingLifeGroupData data) {
		if (!empty) {
			add(new InlineHTML("<hr />"));
		}
		empty = false;
		GroupDataWidget w = new GroupDataWidget();
		w.SetGroupData(data);
		add(w);
	}
	
	@Override 
	public void clear() {
		super.clear();
		add(header);
		empty = true;
	}
}
